'use strict';

angular.module('com.dcos.app').controller('EnvironmentDetailController',function($window,$scope,$uibModalInstance,e_id,c_id,reload,EnvironmentService) {
  var vm = this;

  $scope.curProjectId=$window.sessionStorage.getItem("curProjectId");

  vm.userid=$window.sessionStorage.getItem("curUserId");

  vm.environData=[];

  vm.getDetail = function() {
    EnvironmentService.detail(e_id,c_id).then(function (response) {
        vm.environData=response.data.List[0];
    });
  }
  vm.getDetail();
  // if(!vm.userid)
  //   $state.go('login');

  vm.ok = function () {
    EnvironmentService.update(vm.environData).then(function (response) {
        reload();
        $uibModalInstance.dismiss('cancel');
    });
  }

  vm.cancel = function () {
    $uibModalInstance.dismiss('cancel');
  };
  
});
